// 判断本地存储中是否有userInfo这个字段，如果有就return true  没有就return  false

import { useState } from 'react';

export default function (initialState: object) {
  let [userInfo, setInfo] = useState(initialState);

  let isLogin = JSON.parse(localStorage.getItem('qf-userInfo') || '{}');

  function setUserInfo(newState: object) {
    setInfo(newState);
  }

  return [isLogin, setUserInfo];
}
